package models

import "go.didapinche.com/time"

const AlertHistoryTableName = "t_alert_history"

type AlertType int

type AlertHistory struct {
	ID           uint64    `gorm:"primary_key,column:id" json:"id,omitempty" form:"id"`
	GraphID      uint64    `gorm:"column:graph_id"  json:"graph_id" form:"graph_id"`
	AppID        uint64    `gorm:"column:app_id" json:"app_id,omitempty" form:"app_id"`
	Level        int       `gorm:"column:level" json:"level" form:"level"`
	ApiID        uint64    `gorm:"column:api_id" json:"api_id,omitempty" form:"api_id"`
	DashboardID  uint64    `gorm:"column:dashboard_id" json:"dashboard_id,omitempty" form:"dashboard_id"`
	HostID       uint64    `gorm:"column:host_id" json:"host_id,omitempty" form:"host_id"`
	Kind         int       `gorm:"column:kind" json:"kind"` //类型0：app，1：api，2：host，3：dashboard
	TemplateID   uint64    `gorm:"column:template_id" json:"template_id,omitempty" form:"template_id"`
	DevGroupID   string    `gorm:"column:dev_group_id" json:"dev_group_id,omitempty" form:"dev_group_id"`
	DevGroupName string    `gorm:"column:dev_group_name" json:"dev_group_name,omitempty" form:"dev_group_name"`
	Message      string    `gorm:"column:message" json:"message,omitempty" form:"message"`
	Duration     int64     `gorm:"column:duration" json:"duration,omitempty" form:"duration"`
	StartTime    time.Time `gorm:"column:start_time" json:"start_time,omitempty" form:"start_time"`
	Alerts       *Alerts   `gorm:"type:json;column:alerts" json:"alerts"`
	AlertName    string    `gorm:"column:alert_name" json:"alert_name"`
	AlertLevel   int       `gorm:"column:alert_level" json:"alert_level"`
	ClaimStatus  int       `gorm:"column:claim_status" json:"claim_status"`
	ClaimUser    string    `gorm:"column:claim_user" json:"claim_user"`
	Name         string    `gorm:"column:name" json:"name"`
	Threshold    string    `gorm:"column:threshold" json:"threshold"`
	EndTime      time.Time `gorm:"column:end_time" json:"end_time,omitempty" form:"end_time"`
	Date         string    `gorm:"column:date" json:"date,omitempty"`
	GeneratorURL string    `gorm:"column:generator_url" json:"generator_url"`
	Owner        string    `gorm:"column:owner" json:"owner,omitempty" form:"owner"`
	Type         int       `gorm:"column:type" json:"type"` //0:http,1:zeusserver,2:zeusclient
	Value        string    `gorm:"column:value" json:"value"`
}

func (AlertHistory) TableName() string {
	return AlertHistoryTableName
}
